home *** CD-ROM | disk | FTP | other *** search
- /***
- * URLHelperComponent.h
- *
- * Header file for the URL Helper
- *
- ***/
-
- #pragma once
-
- /**
- ** The component type
- **/
-
- #define URLHelperComponentType 'URLh'
-
- /**
- ** Errors
- **/
-
- enum {
- errURLHNoSuchMirrorList = -2200, // No such mirror list found
- errURLHNoMirrorMatch = -2201, // No mirror matched that URL
- errURLHNameEndsWithReplChar = -2202, // Mirror name ends with a "^"!
- errURLHTooManyReplacements = -2203, // Too many replacement "^"s
- errURLHBadReplChar = -2204, // Bad char after "^"
- errURLHNoUsableMirror = -2205 // index was too large -- end of list!
-
- };
-
- /**
- ** Global types
- **/
- typedef long URLHMirrorFlags;
- typedef long URLHMirrorListRef;
- typedef long URLHParseRef;
- typedef long URLHMirrorRef;
-
- /**
- ** Flags for a mirror
- **/
-
- enum {
- kURLHMDefault = 0, // default mirror usage.
- kURLHMNoUse = 1 // Don't use this in replacement.
- };
-
- /**
- ** The component request codes -- the functions we are going to be running
- **/
-
- enum {
- kDoGetMirrorList = 1,
- kDoNewMirrorList = 2,
- kDoAddMirror = 3,
- kDoNumberOfMirrors = 4,
- kDoGetUsableMirror = 5,
-
- kDoNewParseState = 20,
- kDoDisposeParseState = 21,
- kDoGetMirrorRep = 22
- };
-
- /**
- ** The component instance for all to use
- **/
-
- typedef ComponentInstance URLHelperComponent;
-
- /**
- ** Mirror list stuff
- **
- ** GetMirrorList -- return ref to a mirror list
- ** NewMirrorList -- Create a new mirror list
- ** AddMirror -- add a mirror to a mirror list
- ** NumberOfMirrors -- return the number of mirrors in the list that
- ** are good to use
- ** GetUsableMirror -- Return pointer to a mirror that is usable
- **/
-
- pascal ComponentResult URLHGetMirrorList (
- URLHelperComponent urlInstance,
- StringPtr string,
- URLHMirrorListRef *ref)
- ComponentCallNow (kDoGetMirrorList, 0x08);
-
- pascal ComponentResult URLHNewMirrorList (
- URLHelperComponent urlInstance,
- StringPtr string,
- URLHMirrorListRef *ref)
- ComponentCallNow (kDoNewMirrorList, 0x08);
-
- pascal ComponentResult URLHAddMirror (
- URLHelperComponent urlInstance,
- URLHMirrorListRef ref,
- StringPtr mirrorName,
- URLHMirrorFlags flags)
- ComponentCallNow (kDoAddMirror, 0x0C);
-
- pascal ComponentResult URLHNumberOfMirrors (
- URLHelperComponent urlInstance,
- URLHMirrorListRef ref,
- short *num)
- ComponentCallNow (kDoNumberOfMirrors, 0x08);
-
- pascal ComponentResult URLHGetUsableMirror (
- URLHelperComponent urlInstace,
- URLHMirrorListRef mirrorListRef,
- URLHMirrorRef *mirrorRef,
- short index)
- ComponentCallNow (kDoGetUsableMirror, 0x0A);
-
- /**
- ** Parse Stuff
- **
- ** URLHNewParseState -- Given a URL, find a match in our lists...
- ** URLHDisposeParseState -- Release the memory
- ** URLHGetMirrorRep -- Make a new URL for the indexed mirror.
- **/
-
- pascal ComponentResult URLHNewParseState (
- URLHelperComponent urlInstance,
- StringPtr aURL,
- URLHParseRef *ref)
- ComponentCallNow (kDoNewParseState, 0x08);
-
- pascal ComponentResult URLHDisposeParseState (
- URLHelperComponent urlInstance,
- URLHParseRef ref)
- ComponentCallNow (kDoDisposeParseState, 0x04);
-
- pascal ComponentResult URLHGetMirrorRep (
- URLHelperComponent urlInstance,
- URLHParseRef ref,
- StringPtr newUrl,
- short mirrorIndex)
- ComponentCallNow (kDoGetMirrorRep, 0x0A);
-
-